using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Android.App;
using Android.Content;
using Android.OS;
using Android.Runtime;
using Android.Views;
using Android.Widget;

namespace atomtask
{
	[Activity (Label = "")]			
	public class OnOffActivity : Activity
	{
		private Button online;
		private Button offline;

		private void init()
		{
			online = FindViewById<Button> (Resource.Id.btn_MainOnOff_Online);
			offline = FindViewById<Button> (Resource.Id.btn_MainOnOff_Offline);

			// Click Online button
			online.Click += new EventHandler (click_online);
			// Click Offline button
			offline.Click += new EventHandler (click_offline);
		}

		protected override void OnCreate (Bundle bundle)
		{
			base.OnCreate (bundle);

			// Set our view from the "Online/Offline" layout
			SetContentView (Resource.Layout.Main_OnOff);

			// Initialize
			init ();
		}

		private void click_online (object sender, EventArgs arg)
		{
			disableAllWidget ();

			StartActivity (typeof(LoginActivity));
			this.Finish ();
		}

		private void click_offline (object sender, EventArgs arg)
		{
			disableAllWidget ();
		}

		// Disable all widgets
		private void disableAllWidget ()
		{
			online.Enabled = false;
			offline.Enabled = false;
		}
	}
}

